home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************
- ADOBE SYSTEMS INCORPORATED
- Copyright 2002 Adobe Systems Incorporated
- All Rights Reserved
-
- NOTICE: Adobe permits you to use, modify, and distribute this
- file in accordance with the terms of the Adobe license agreement
- accompanying it. If you have received this file from a source
- other than Adobe, then your use, modification, or distribution
- of it requires the prior written permission of Adobe.
- ***************************************************************/
- /***************************************************************
- Author: Mary Obelnicki
- ***************************************************************/
-
- /***************************************************************
-
- The following script creates a key frame animation effect on
- the currently selected objects.
-
- Function:
- sprialExit(letters, turns, radius, frames, stagger, forward, startNow, keyFrameRate)
-
- Arguments:
- <letters> LMObject - an array of the objects to apply the
- effect. Does not have to be text objects. It can be
- any LMObject.
- <turns> integer - the number of rotations (360 degrees)
- <radius> integer - the final radius of the spiral rotation
- <frames> integer - the length of the animation for each
- object
- <stagger> integer - the number of frames to stagger the
- start of each animation
- <startNow> boolean - should the animation start now, at
- the current frame, or end now.
- <keyFrameRate> integer - the number of frames between key frames.
-
- ***************************************************************/
-
- /***************************************************************
- To change the behavior of this script, make your changes below
- ***************************************************************/
-
- sprialExit(application.currentComposition.selection, 2, 50, 24, 3, true, true, 1);
-
- /***************************************************************
- DO NOT EDIT BELOW THIS LINE
- ***************************************************************/
-
- function sprialExit(letters, turns, radius, frames, stagger, forward, startNow, keyFrameRate)
- {
- if(letters.length < 1)
- return;
- var xsd = new Array;
- var ysd = new Array;
- var oriRot = new Array;
- var oriScalex = new Array;
- var oriScaley = new Array;
- var oriOpacity = new Array;
- var i;
-
- for(i = 0; i < letters.length; i++)
- {
- xsd[i] = letters[i].position.x;
- ysd[i] = letters[i].position.y;
- oriRot[i] = letters[i].rotation % 360;
- oriScalex[i] = letters[i].scale.x;
- oriScaley[i] = letters[i].scale.y;
- oriOpacity[i] = letters[i].opacity;
- }
-
- var xoffst = xsd[0];
- var yoffst = ysd[0];
- for(i = 0; i < xsd.length; i++)
- {
- xsd[i] -= xoffst;
- ysd[i] -= yoffst;
- }
-
- var xaverage=0;
- var yaverage=0;
- for(i=0; i < letters.length; i++)
- {
- xaverage += letters[i].position.x;
- yaverage += letters[i].position.y;
- }
-
- xaverage = xaverage/letters.length;
- yaverage = yaverage/letters.length;
-
- var xs = xoffst -radius; //cl.position.x - 2 * radius;
- var ys = yaverage;
-
- var frame0;
- if (startNow)
- frame0 = letters[0].currentFrame;
- else
- frame0 = letters[0].currentFrame - (stagger * (letters.length - 1) + frames);
- var angle = -turns*2*Math.PI;
- var dAngledf = angle/frames;
-
- //set up initial conditions
-
- for (j = 0; j < letters.length; j++)
- {
-
- var cl = letters[j];
-
- cl.stopwatch.position = true;
- cl.stopwatch.rotation = true;
- cl.stopwatch.scale = true;
- cl.stopwatch.opacity = true;
-
- }
-
- var df;
-
- for (df = 0; df <= frames; df += keyFrameRate)
- {
- var curAngle = dAngledf * df;
- var curRadius = radius *(1- df/frames);
- for (j = 0; j < letters.length; j++)
- {
- var i;
- if(forward)
- i=j;
- else
- i = letters.length - 1 - j;
- var cl = letters[i];
-
- cl.currentFrame = frame0 +df + (j * stagger);
-
- cl.position.x = xs + ((curRadius + xsd[i]) * Math.cos(curAngle));
- cl.position.y = ys + ((curRadius + ysd[i]) * Math.sin(curAngle));
- cl.rotation = curAngle*(180/Math.PI) + oriRot[i]; //maintain original angle through spiral?
- cl.opacity = oriOpacity[i] * ( 1- df/frames);
- cl.scale.x = (1- df/frames) * oriScalex[i];
- cl.scale.y = (1 - df/frames) * oriScaley[i];
-
- }
-
-
- }
-
- for (j=0; j<letters.length; j++)
- {
- var i;
- if(forward)
- i=j;
- else
- i = letters.length - 1 - j;
- var cl = letters[i];
-
- cl.currentFrame = frame0 + frames + (j * stagger);
-
- cl.position.x = xs + ((0 + xsd[i]) * Math.cos(0));
- cl.position.y = ys + ((0 + ysd[i]) * Math.sin(0));
- cl.rotation = angle*(180/Math.PI) + oriRot[i];
- cl.opacity = 0;
- cl.scale.x = 0;
- cl.scale.y = 0;
-
- }
-
- }
-
-
-
-